<template>
  <div>
      <van-nav-bar
  title="搜索"
 
  left-arrow
  @click-left="$router.go(-1)"
/>
    <van-search
      v-model="keyword"
      shape="round"
      placeholder="请输入搜索关键词"
    />
    <gList :users="seach" />
    <!-- 返回顶部 -->
    <el-backtop :visibility-height="400" :bottom="80"></el-backtop>
  </div>
</template>
<script>
import gList from "./gList";
export default {
  components: {
    gList,
  },
  data() {
    return {
      keyword: "",
      users: [],
    };
  },
  created() {
    this.List();
  },
  methods: {
    List() {
      this.$axios.get("/json/list1.json").then((res) => {
        console.log(res.result);
        this.users = res.result;
      });
    },
  },
 computed:{
     seach(){
         return this.users.filter(item=>{
         return item.title.indexOf(this.keyword) > -1
     })
     }
     
 }
};
</script>